package com.hy.Redis;

import java.util.Random;

/**
 * 随机生成验证码工具类
 */
public class ValidateCodeUtils {

    public static Integer generateValidateCode(int length){
        Integer code = null;
        if(length == 4){
            code = new Random().nextInt(10000);
            if(code < 1000){
                code = code+1000;//保证四位数
            }
        }
        return code;
    }

}
